home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Games / Pentominoes 2.0 / Shell ƒ / generic window handlers.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-15  |  7.9 KB  |  93 lines  |  [TEXT/MMCC]

  1. #include "generic window handlers.h"
  2. #include "program globals.h"
  3. #include "text layer.h"
  4. #if USE_DRAG
  5. #include "drag layer.h"
  6. #endif
  7. #include "window layer.h"
  8. #include "key layer.h"
  9. #include "main.h"
  10.  
  11. #if USE_STYLED_TEXT
  12. #include "styled text layer.h"
  13. #endif
  14.  
  15. #define kGrowBoxSize    15
  16.  
  17. extern    Boolean            gInProgress;    /* see environment.h */
  18. extern    Boolean            gCustomCursor;
  19.  
  20. void GenericCopybits(WindowRef theWindow, WindowRef offscreenWindowRef, Boolean active,
  21.     Boolean drawGrowIconLines)
  22. {
  23.     Rect            tempRect;
  24.     
  25.     if (active)
  26.     {
  27.         DrawGrowIconNoLines(theWindow, drawGrowIconLines);
  28.     }
  29.     else
  30.     {
  31.         tempRect.bottom=theWindow->portRect.bottom;
  32.         tempRect.right=theWindow->portRect.right;
  33.         tempRect.left=tempRect.right-kGrowBoxSize+1;
  34.         tempRect.top=tempRect.bottom-kGrowBoxSize+1;
  35.         EraseRect(&tempRect);
  36.     }
  37.     
  38.     UpdateControls(theWindow, theWindow->visRgn);
  39.     
  40.     tempRect=theWindow->portRect;
  41.     tempRect.bottom-=kGrowBoxSize;
  42.     tempRect.right-=kGrowBoxSize;
  43.     CopyBits(    &(offscreenWindowRef->portBits),
  44.                 &(theWindow->portBits),
  45.                 &tempRect, &tempRect, 0, 0L);
  46. }
  47.  
  48. void GenericResizeControls(WindowRef theWindow, short destOverload, short headerHeight,
  49.     Boolean isStyled)
  50. {
  51. #if !USE_STYLED_TEXT
  52.     #pragma unused(isStyled)
  53. #endif
  54.     
  55.     TEHandle        hTE;
  56.     ControlHandle    vScrollBar, hScrollBar;
  57.     
  58.     hTE=GetWindowTE(theWindow);
  59.     vScrollBar=GetWindowVScrollBar(theWindow);
  60.     hScrollBar=GetWindowHScrollBar(theWindow);
  61.     AdjustScrollSizes(theWindow, hTE, vScrollBar, hScrollBar, destOverload, headerHeight);
  62. #if USE_STYLED_TEXT
  63.     if (!isStyled)
  64. #endif
  65.         AdjustViewRect(hTE);
  66.     TECalText(hTE);
  67. #if USE_STYLED_TEXT
  68.     if (isStyled)
  69.     {
  70.         StyledAdjustForEndScroll(vScrollBar, hTE);
  71.         StyledAdjustVScrollBar(vScrollBar, hTE);
  72.     }
  73.     else
  74.     {
  75. #endif
  76.         AdjustForEndScroll(vScrollBar, hTE);
  77.         AdjustVScrollBar(vScrollBar, hTE);
  78. #if USE_STYLED_TEXT
  79.     }
  80. #endif
  81. #if USE_DRAG
  82.     ResetHiliteRgn(theWindow);
  83. #endif
  84. }
  85.  
  86. void GenericGetGrowSize(Rect *sizeRect)
  87. {
  88.     SetRect(sizeRect, 200, 48+kGrowBoxSize+1, 32766, 32767);
  89. }
  90.  
  91. void GenericIdleInWindow(WindowRef theWindow, Point mouseLoc)
  92. {
  93.     TEHandle